import React from 'react'
import { Form, Button, Modal, Input } from 'antd'
import { LwjButton } from "components";
import LwjTable from 'components/LwjTable/LwjTable'
import DescriptionList from 'components/DescriptionList';
import moment from 'moment';
//数据

const StoreModal = ({
  visible,
  currentItem,
  dispatch,
  loading,
  form: { getFieldDecorator, validateFields },
  ...tableProps
}) => {
  const { Description } = DescriptionList;

  const FormItem = Form.Item;

  const formItemLayout = {
    labelCol: {
      xs: { span: 4 },
      sm: { span: 4 },
    },
    wrapperCol: {
      xs: { span: 20 },
      sm: { span: 20 },
    },
  };
  // console.info(currentItem.id);/
  return (
    <div>
      <Modal
        visible={visible}
        title={"设为商品库"}
        loading={global}
        destroyOnClose={true}
        onOk={() => {
          validateFields((err, values) => {
            if (err) {
              return;
            }
            else {
              dispatch({

                type: 'storelist/library', payload: {
                  distributorId: currentItem.id,
                  ...values
                }
              })
              dispatch({
                type: 'storelist/setLibraryVisible',
                payload: false
              })
            }
          });

        }}
        onCancel={() => dispatch({
          type: 'storelist/setLibraryVisible',
           payload: false
        })}
      >
        <Form>
          <FormItem label="商品库名称:" {...formItemLayout}>
            {getFieldDecorator('name', {
              rules: [{ required: true, message: '请输入商品库名称' }],
            })(<Input type="textarea" placeholder="请输入商品库名称" />)}
          </FormItem>
        </Form>
      </Modal>

    </div>

  )

};


export default Form.create()(StoreModal)
